|
![](/i/fill.gif) |
"Mark Hanford" <ren### [at] blueyonder co uk> wrote in message
news:3ca4518f@news.povray.org...
>
> I have an object created at the origin and oriented along the x-axis (an
> arrow, actually).
> What I want to do is rotate the arrow to point in a particular direction,
as
> specified by a vector.
>
> So for a vector of <3,3,0>, the rotation should be <0,0,45>
Well, there is vaxis_rotate and vrotate but those result in a vector
position, not the rotational amount between two vectors. I'm no math wizard
to begin with so I'm not sure if there is an easy way. In the beta of 3.5
(3.1 and 3.5 are going to be quite different regarding this I believe) a
math 'include' macro might do okay. One is VAngleD, which can result in the
number of degrees between two vectors. Might be a problem if you wanted it
to give you the axis of rotation, but another macro called VRotationD will
give you the degrees rotated based on what you specify as the rotational
axis. See my example of that, if you have version 3.5:
#include "math.inc"
#declare Angle=VRotationD(x, <3,3,0>, z);
text {ttf "timrom.ttf", str(Angle,0,0), 1, 0
pigment {color red 1}
}
Note that I used "x" for the first vector (same as <1,0,0>) because the
macro can't see <0,0,0> in a way that can figure it out apparently. So you'd
think of the first as a starting plane, I guess that's a good way to explain
it. If the vectors are non-zero then the macro can calculate against those
as planes, from what I can tell. Also, sign (+/-) is based on a different
geometry from the left-handedness rotation, it would seem. Frankly, I'm not
certain how it is done and what results should be expected.
Perhaps someone else could give you a better idea.
bob h
Post a reply to this message
|
![](/i/fill.gif) |